package com.study.spring_aop_log.controller;


import com.study.spring_aop_log.aop.OrderLogAnnotation;
import com.study.spring_aop_log.pojo.OrderGood;
import com.study.spring_aop_log.service.OrderGoodService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 作者
 * @since 2022-05-18 17:10:13
 */
@RestController
@RequestMapping("/orderGood")
public class OrderGoodController {

    @Autowired
    private OrderGoodService orderGoodService;

    @ApiOperation(value = "下单", httpMethod = "POST")
    @PostMapping("/add")
    @OrderLogAnnotation(msg = "xxxxxxxx",operation = 2,uid = 3)
    public void addTest(@RequestBody OrderGood orderGood) {
        orderGoodService.save(orderGood);
    }


    @ApiOperation(value = "修改", httpMethod = "POST")
    @PostMapping("/update/{id}")
    @OrderLogAnnotation(msg = "lllll",operation = 1,uid = 5)
    public void upTest(@RequestBody OrderGood orderGood) {
        orderGoodService.updateById(orderGood);
    }
}

